package com.newtouch;

import com.newtouch.config.MyBatisConfig;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

/**
 * 项目程序运行主类
 */
@SpringBootApplication
@Import(MyBatisConfig.class) // 导入MyBatis配置
public class VolunteerApplication extends SpringBootServletInitializer {

    private static final Log debugLog = LogFactory.getLog(VolunteerApplication.class);

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        return builder.sources(VolunteerApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(VolunteerApplication.class, args);
    }

    @Bean
    public ApplicationRunner startupLogger() {
        return args -> debugLog.info("========== Application started ===============");
    }
}

